import java.util.Scanner;

public class test1 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m = sc.nextInt();
        int[] nums = new int[m];
        for (int i = 0; i < nums.length ; i++) {
            nums[i] = sc.nextInt();
        }
        System.out.println("输入要加的次数");
        int k = sc.nextInt();
        int sum = 0;
        for(int i =0;i<k;i++){
            int a =0;
            int max = nums[0];
            for(int j=0;j<nums.length;j++){
                if(nums[i]>max){
                    max = nums[i];
                    a = i;
                }
            }
            nums[a]++;
            sum +=max;
        }
        System.out.println(sum);
    }

}
